import React, { lazy } from 'react'
import type { RouteObject } from 'react-router-dom'
import Redirect from './Redirect'
import RenderPage from './RenderPage'
import Layout from '@/components/Layout'

import Login from '@/pages/account/Login'
import Register from '@/pages/account/Register'

import Home from '@/pages/Home/index'

const home = { 
  path: 'index', 
  element: <RenderPage stack={[{title: '首页'}]} element={<Home />} routerMeta={
    { 
      name: '__index__',
      path: '/index',
      component: '',
      meta: {
        title: '首页'
      }
    }
  } 
  path='/index'
  /> 
}

export const basicRoute:RouteObject[] = [
  {
    path: "/login",
    element: <Login />,
  },
  {
    path: "/register",
    element: <Register />,
  },
  {
    path: "/",
    element: <Layout />,
    children: [
      { index: true, element: <Redirect to='/index' /> },
      home,
    ]
  }
]

export default basicRoute